const mysql = require('mysql')


const db = mysql.createPool({
  host: '127.0.0.1',
  user: 'root',
  password: 'root',
  database: 'express_mysql',
  debug: ['ComQueryPacket', 'RowDataPacket'],
})


db.on('connection', function(connection) {
    
  // console.log("a mysql connection with Id: " + connection.threadId);
  connection.on('enqueue', function(sequence) {
    // if (sequence instanceof mysql.Sequence.Query) {
    if ('Query' === sequence.constructor.name) {
      console.log('sequence',sequence.sql);
    }
  });
});

module.exports = db